package main

import "fmt"

func slice_binaryFind(arr *[6]int, leftIndex  int, rightIndex int, findVal int){
	if leftIndex > rightIndex{
		fmt.Println("can't find")
		return
	}

	middle := (leftIndex + rightIndex) / 2

	if (*arr)[middle] > findVal{
		slice_binaryFind(arr, leftIndex, middle - 1, findVal)
	}else if (*arr)[middle] < findVal{
		slice_binaryFind(arr, middle + 1, rightIndex, findVal)
	}else{
		fmt.Printf("找到了下标为： %v\n", middle)
	}
}

func main() {
	arr := [6]int{1,8,10,89,1000,1234}

	slice_binaryFind(&arr, 0, len(arr) - 1, 1)
}